﻿<RibbonWindow xmlns:SeleniumRecorder="clr-namespace:SeleniumRecorder"  x:Class="SeleniumRecorder.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
               
              Icon="pack://application:,,,/Resources/favicon.ico"  
        Title="Selenium Recorder"  WindowState="Maximized"   Background="{DynamicResource WindowBackgroundBrush}">

    
    <RibbonWindow.Resources>
        <LinearGradientBrush x:Key="WindowBackgroundBrush" StartPoint="0,0" EndPoint="0,1">
            <GradientStop Color="White" Offset=".7"/>
            <GradientStop Color="DarkBlue" Offset=".0001"/>
            <GradientStop Color="#FF3464C4" Offset="1"/>
            <GradientStop Color="#FF202E7E" Offset="1"/>
        </LinearGradientBrush>

        
        
        <SolidColorBrush x:Key="textForeColorResource" Color="White"/>
        <Border x:Key="Border" BorderBrush="Gray"
                Background="LightBlue"
                BorderThickness="2"
                Padding="8" />
        <Color x:Key="ControlForeground">#181818</Color>
        <Color x:Key="ControlReadOnlyForeground">#383838</Color>
        <Color x:Key="ControlDisabledForeground">#686868</Color>

        <Color x:Key="ControlBackground">#f7f7f9</Color>
        <Color x:Key="ControlHoveredBackground">#fafafc</Color>
        <Color x:Key="ControlFocusedBackground">#fdfdff</Color>
        <Color x:Key="ControlReadOnlyBackground">#f2f2f4</Color>
        <Color x:Key="ControlDisabledBackground">#efeff2</Color>

        <Color x:Key="ControlBorder">#383838</Color>
        <Color x:Key="ControlHoveredBorder">#0BBAE0</Color>
        <Color x:Key="ControlFocusedBorder">#000000</Color>
        <Color x:Key="ControlReadOnlyBorder">#484848</Color>
        <Color x:Key="ControlDisabledBorder">#787878</Color>
        <Style x:Key="MenuItemStyle" TargetType="{x:Type MenuItem}">
            <Setter Property="Background">
                <Setter.Value>
                    <LinearGradientBrush EndPoint="0,1" StartPoint="0,0" >
                        <GradientStop Color="#FF3A60AD" Offset="0.528"/>
                        <GradientStop Color="#FF6A85D8" Offset="0.01"/>
                        <GradientStop Color="#FF3464C4" Offset="1"/>
                        <GradientStop Color="#FF202E7E" Offset="1"/>
                    </LinearGradientBrush>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="TextBoxBaseStyle" TargetType="{x:Type TextBox}">
            <Setter Property="Background">
                <Setter.Value>
                    <SolidColorBrush Color="{StaticResource ControlBackground}"/>
                </Setter.Value>
            </Setter>
            <Setter Property="Foreground">
                <Setter.Value>
                    <SolidColorBrush Color="{StaticResource ControlForeground}"/>
                </Setter.Value>
            </Setter>
            <Setter Property="Padding" Value="8 4"/>
            <Setter Property="HorizontalAlignment" Value="Stretch"/>
            <Setter Property="HorizontalContentAlignment" Value="Left"/>
            <Setter Property="VerticalAlignment" Value="Stretch"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="BorderBrush">
                <Setter.Value>
                    <SolidColorBrush Color="{StaticResource ControlBorder}"/>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="{x:Type TextBox}" TargetType="{x:Type TextBox}" BasedOn="{StaticResource TextBoxBaseStyle}" />
        <ContextMenu x:Key="cmButton">
            <MenuItem Header="Add Control" Click="MenuItem_Click_AddControl" />
            <Separator />
            <MenuItem Header="Add Siblings" Click="MenuItem_Click_AddSiblings" />
        </ContextMenu>

        <ContextMenu x:Key="TreeViewContext">
            <MenuItem Header="Delete" Click="MenuItem_Click_Delete" />
            <Separator />
            <MenuItem Header="Set Properties" Click="MenuItem_Click_SetProperties" />
        </ContextMenu>

        <!--<Style TargetType="{x:Type TreeViewItem}">
            <Setter Property="Foreground" Value="Blue"/>
            <Setter Property="FontSize" Value="13"/>
            <Setter Property="BorderBrush" Value="Black"></Setter>
            <Setter Property="Background" Value="White"></Setter>
            <Setter Property="Padding" Value="2"></Setter>
            <Setter Property="MinWidth" Value="100"></Setter>
            <Setter Property="Margin" Value="1"></Setter>
            <Setter Property="BorderThickness" Value="1"></Setter>
            <Setter Property="FontWeight" Value="Bold" />
        </Style>-->
        <SolidColorBrush x:Key="GlyphBrush" Color="#444" />
        <Style x:Key="ExpandCollapseToggleStyle" TargetType="ToggleButton">
            <Setter Property="Focusable" Value="False"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ToggleButton">
                        <Grid
          Width="15"
          Height="13"
          Background="Transparent">
                            <Path x:Name="ExpandPath"
            HorizontalAlignment="Left" 
            VerticalAlignment="Center" 
            Margin="1,1,1,1"
            Fill="{StaticResource GlyphBrush}"
            Data="M 4 0 L 8 4 L 4 8 Z"/>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsChecked"
               Value="True">
                                <Setter Property="Data"
                TargetName="ExpandPath"
                Value="M 0 4 L 8 4 L 4 8 Z"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="TreeViewItemFocusVisual">
            <Setter Property="Control.Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Border>
                            <Rectangle Margin="0,0,0,0"
                 StrokeThickness="5"
                 Stroke="Black"
                 StrokeDashArray="1 2"
                 Opacity="0"/>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="{x:Type TreeViewItem}"
     TargetType="{x:Type TreeViewItem}">
            <Setter Property="Background"
      Value="Transparent"/>
            <Setter Property="BorderBrush" Value="Black"></Setter>
           
            <Setter Property="Padding" Value="2"></Setter>
            <Setter Property="MinWidth" Value="100"></Setter>
            <Setter Property="Margin" Value="1"></Setter>
            <Setter Property="BorderThickness" Value="1"></Setter>
            <Setter Property="HorizontalContentAlignment"
      Value="{Binding Path=HorizontalContentAlignment,
              RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
            <Setter Property="VerticalContentAlignment"
      Value="{Binding Path=VerticalContentAlignment,
              RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
            <!--<Setter Property="Padding"
      Value="1,0,0,0"/>-->
            <Setter Property="Foreground"
      Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
            <Setter Property="FocusVisualStyle"
      Value="{StaticResource TreeViewItemFocusVisual}"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type TreeViewItem}">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition MinWidth="19"
                      Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <ToggleButton x:Name="Expander"
                  Style="{StaticResource ExpandCollapseToggleStyle}"
                  IsChecked="{Binding Path=IsExpanded,
                              RelativeSource={RelativeSource TemplatedParent}}"
                  ClickMode="Press"/>
                            <Border Name="Bd"
              Grid.Column="1"
              Background="{TemplateBinding Background}"
              BorderBrush="{TemplateBinding BorderBrush}"
              BorderThickness="{TemplateBinding BorderThickness}"
              Padding="{TemplateBinding Padding}">
                                <ContentPresenter x:Name="PART_Header"
                      ContentSource="Header"
                      HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"/>
                            </Border>
                            <ItemsPresenter x:Name="ItemsHost"
                  Grid.Row="1"
                  Grid.Column="1"
                  Grid.ColumnSpan="2"/>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsExpanded"
               Value="false">
                                <Setter TargetName="ItemsHost"
                Property="Visibility"
                Value="Collapsed"/>
                            </Trigger>
                            <Trigger Property="HasItems"
               Value="false">
                                <Setter TargetName="Expander"
                Property="Visibility"
                Value="Hidden"/>
                            </Trigger>
                            <MultiTrigger>
                                <MultiTrigger.Conditions>
                                    <Condition Property="HasHeader"
                     Value="false"/>
                                    <Condition Property="Width"
                     Value="Auto"/>
                                </MultiTrigger.Conditions>
                                <Setter TargetName="PART_Header"
                Property="MinWidth"
                Value="75"/>
                            </MultiTrigger>
                            <MultiTrigger>
                                <MultiTrigger.Conditions>
                                    <Condition Property="HasHeader"
                     Value="false"/>
                                    <Condition Property="Height"
                     Value="Auto"/>
                                </MultiTrigger.Conditions>
                                <Setter TargetName="PART_Header"
                Property="MinHeight"
                Value="19"/>
                            </MultiTrigger>
                            <Trigger Property="IsSelected"
               Value="true">
                                <Setter TargetName="Bd"
                Property="Background"
                Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
                                <Setter Property="Foreground"
                Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>
                            </Trigger>
                            <MultiTrigger>
                                <MultiTrigger.Conditions>
                                    <Condition Property="IsSelected"
                     Value="true"/>
                                    <Condition Property="IsSelectionActive"
                     Value="false"/>
                                </MultiTrigger.Conditions>
                                <Setter TargetName="Bd"
                Property="Background"
                Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
                                <Setter Property="Foreground"
                Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
                            </MultiTrigger>
                            <Trigger Property="IsEnabled"
               Value="false">
                                <Setter Property="Foreground"
                Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </RibbonWindow.Resources>


    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>
        </Grid.RowDefinitions>

        <Ribbon  AllowDrop="True" IsMinimized="{Binding CollapseRib, UpdateSourceTrigger=PropertyChanged}"   x:Name="RibbonWin"   SelectedIndex="0"  Background="White">

            <!-- Help Pane, located at the right-hand side -->
            <Ribbon.HelpPaneContent>
                <RibbonButton SmallImageSource="Images\help.png" />
            </Ribbon.HelpPaneContent>

            <!-- Quick Access Toolbar - located at the upper-left corner -->
            <Ribbon.QuickAccessToolBar>
                <RibbonQuickAccessToolBar >
                    <RibbonButton x:Name ="Save" SmallImageSource="Images\save.png"  Command="{Binding SaveCommand}" />

                    <RibbonButton x:Name ="Collapse" HorizontalAlignment="Right" Command="{Binding CollapseRibbon}" SmallImageSource="Images\up-icon.png" />
                </RibbonQuickAccessToolBar>

            </Ribbon.QuickAccessToolBar>

            <!-- Application Menu, located at the left-hand side (down arrow) -->
            <Ribbon.ApplicationMenu  x:Uid="FileMenuContainer">
                <RibbonApplicationMenu   DropDownOpened="FileMenu_DropDownOpened_1" DropDownClosed="FileMenu_DropDownClosed_1"  Selector.IsSelected="True"  IsEnabled="True" RibbonControlService.Label="File"  IsMainMenu="True" Name="FileMenu" Tag="File"  Width="50" KeyTip="F">

                    <RibbonApplicationMenuItem Header="Start" Command="{Binding NewCommand}" ImageSource="Images\new.png" />
                    <RibbonApplicationMenuItem Header="Open" Command="{Binding OpenCommand}" ImageSource="Images\Open-file-icon.png" />
                    <RibbonApplicationMenuItem Header="Save" Command="{Binding SaveCommand}" ImageSource="Images\1353183085_save.png" />
                    <!--<RibbonApplicationMenuItem Header="Options" Command="{Binding OptionCommand}"  ImageSource="Images\options.png" />-->
                    <RibbonApplicationMenuItem Header="Exit" Command="{Binding ExitCommand}" ImageSource="Images\quit.png" />
                </RibbonApplicationMenu>
            </Ribbon.ApplicationMenu>

            <!-- Ribbon Tab #1: Home -->
            <RibbonTab Header="View" IsEnabled="{Binding EnableTabs, UpdateSourceTrigger=PropertyChanged}" KeyTip="H" >

                <!-- Home  group-->
                <RibbonGroup x:Name="ClipboardGroup" Header="Home">

                    <RibbonCheckBox IsChecked="{Binding !CollapseRib, UpdateSourceTrigger=PropertyChanged}"  Command="{Binding CollapseRibbon}"    Label="Hide Ribbon" KeyTip="X" />

                </RibbonGroup>

                <!-- Employee And Payroll group-->
              
            </RibbonTab>

            <!-- Ribbon Tab #2: Launch -->
            <RibbonTab Header="Map" x:Name="MapTabParent" KeyTip="I" IsEnabled="{Binding EnableTabs, UpdateSourceTrigger=PropertyChanged}" >
                <!-- Launch/Applications group-->
                <RibbonGroup x:Name="MapTab" Header="Map Settings">
                    <RibbonButton SmallImageSource="Images\Filter.png" Label="Filter Controls" Command="{Binding FilterControls}" KeyTip="X" />
                    <RibbonButton SmallImageSource="Images\Reset.png" Label="Reset Controls" Command="{Binding ResetTree}" KeyTip="X" />
                </RibbonGroup>
                <RibbonGroup x:Name="Operations" Header="Node Operations" >
                    <RibbonButton SmallImageSource="Images\Delete.png" IsEnabled="{Binding TreeItemSelected,UpdateSourceTrigger=PropertyChanged}" Label="Delete" Command="{Binding DeleteCommand}" KeyTip="X" />
                    <RibbonButton SmallImageSource="Images\save.png"  IsEnabled="{Binding SaveChangesEnabled,UpdateSourceTrigger=PropertyChanged}" Label="Save Changes" Command="{Binding SaveChanges}" KeyTip="X" />
                </RibbonGroup>

                <RibbonGroup x:Name="Properties"  Header="Control Search Properties" IsEnabled="{Binding TreeItemSelected,UpdateSourceTrigger=PropertyChanged}">

                    <RibbonComboBox Name="Searchproperties" Label="Search Properties : ">
                        <RibbonGallery SelectedValue="Name" Name="SearchPropertyRB"
                            SelectedValuePath="Content" 
                          MaxColumnCount="1" SelectionChanged="SearchPropertyRB_SelectionChanged_1">
                            <RibbonGalleryCategory>
                                <RibbonGalleryItem Content="Id"  />
                                <RibbonGalleryItem Content="Name"  />
                                <RibbonGalleryItem Content="ClassName"  />
                                <RibbonGalleryItem Content="TagName"  />
                                <RibbonGalleryItem Content="CSSSelector" />
                                <RibbonGalleryItem Content="PartialLinkText" />
                                <RibbonGalleryItem Content="LinkText" />
                                <RibbonGalleryItem Content="XPath" />
                            </RibbonGalleryCategory>
                        </RibbonGallery>

                    </RibbonComboBox>

                    <RibbonComboBox Name="CSSProperties" Label="CSS Properties : " Visibility="Collapsed">
                        <RibbonGallery SelectedValue="Name" Name="CSSPropertiesRB"
                            SelectedValuePath="Content" 
                          MaxColumnCount="1"  SelectionChanged="CSSPropertiesRB_SelectionChanged_1">
                        </RibbonGallery>
                    </RibbonComboBox>
                    <RibbonTextBox TextBoxWidth="120"   Name="SearchValue" Label="Search Value : "></RibbonTextBox>
                </RibbonGroup>

                <RibbonGroup x:Name="FieldValues" Width="250" Header="Field Properties" IsEnabled="{Binding TreeItemSelected,UpdateSourceTrigger=PropertyChanged}">
                    <RibbonTextBox TextBoxWidth="120"   Name="FieldName" Text="{Binding FieldNameControl,UpdateSourceTrigger=PropertyChanged}"   Label="Field Name : "></RibbonTextBox>
                    <RibbonTextBox TextBoxWidth="120"   Name="Parent" Text="{Binding ParentName,UpdateSourceTrigger=PropertyChanged}"  Label="Parent Field : "></RibbonTextBox>
                </RibbonGroup>
            </RibbonTab>

            <RibbonTab Header="Generate" KeyTip="L" IsEnabled="{Binding EnableTabs, UpdateSourceTrigger=PropertyChanged}" >
                <!-- Launch/Applications group-->
                <RibbonGroup x:Name="Generate" Header="Generate Code">
                    <RibbonMenuButton LargeImageSource="Images\code.png" Label="Generate" KeyTip="V">
                        <RibbonButton SmallImageSource="Images\code.png" Command="{Binding GeneratePOM}" Label="Page Object Model" KeyTip="T"/>
                        <RibbonButton SmallImageSource="Images\code.png" Command="{Binding GeneratePageFactory}" Label="Page Factory" KeyTip="S"/>
                        <RibbonButton SmallImageSource="Images\code.png" Command="{Binding GenerateCustomCode}"  Label="Custom Factory" KeyTip="S"/>
                    </RibbonMenuButton>

                </RibbonGroup>

            </RibbonTab>


        </Ribbon>
        <Grid Name="UIPanel" Grid.Row="1" >
            <Grid Visibility="{Binding VisibleHome}" >
                <Grid.RowDefinitions>
                    <RowDefinition Height="2*"></RowDefinition>
                    <RowDefinition Height="2*"></RowDefinition>
                    <RowDefinition Height="2*"></RowDefinition>
                </Grid.RowDefinitions>

                <Label FontSize="30" HorizontalAlignment="Center" Foreground="White" Grid.Row="1">Welcome To Selenium Recorder</Label>
            </Grid>

           
             <Grid Visibility="{Binding Visible}" >
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="40"/>
                        <RowDefinition Height="20" />
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="30"/>
                    </Grid.RowDefinitions>

                    <Grid Grid.Row="0" Margin="10,10,0,0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="1*" />
                            <ColumnDefinition Width="9*" />
                            <ColumnDefinition Width="1*" />
                        </Grid.ColumnDefinitions>
                        <TextBlock FontSize="15" TextWrapping="Wrap" Foreground="White" Grid.Column="0" Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center"><Bold><Run Text="URL :"/></Bold>

                        </TextBlock>

                        <TextBox x:Name="URL"  Grid.Column="1"  Grid.Row="0"   FontSize="15" Background="{DynamicResource textForeColorResource}">

                            <TextBox.BitmapEffect>
                                <DropShadowBitmapEffect></DropShadowBitmapEffect>

                            </TextBox.BitmapEffect>
                        </TextBox>
                        <Button x:Name="GOButton" Command="{Binding ChangeSubMessageCommand}" Margin="2" Grid.Column="2"  Grid.Row="0"   HorizontalAlignment="Center"    Width="60" >
                            <Button.FontWeight>
                                <FontWeight>Bold</FontWeight>
                            </Button.FontWeight>
                            <Button.BitmapEffect>
                                <DropShadowBitmapEffect></DropShadowBitmapEffect>
                            </Button.BitmapEffect>
                            <WrapPanel>
                                <TextBlock Foreground="Blue"><Run Text="GO"/></TextBlock>
                            </WrapPanel>
                        </Button>
                    </Grid>
                    <Grid Grid.Row="1">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="1*" />
                            <ColumnDefinition Width="9*" />
                            <ColumnDefinition Width="1*" />
                        </Grid.ColumnDefinitions>
                        <ProgressBar Grid.Column="2" x:Name="LoadProgress" />
                    </Grid>
                    <Grid Grid.Row="2">
                        <Grid.Background>
                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                <GradientStop Color="Black" Offset="0"/>
                                <GradientStop Color="#FFF7F3F3" Offset="1"/>
                            </LinearGradientBrush>
                        </Grid.Background>

                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="1*" />
                            <ColumnDefinition Width="5" />
                            <ColumnDefinition Width="5*"  />
                        </Grid.ColumnDefinitions>
                        <Border Grid.Column="3" Grid.Row="3"  BorderBrush="Black" 
        BorderThickness="2,2,2,2" Background="{x:Null}" />

                        <TreeView x:Name="ControlTree" BorderBrush="#FF000000"

    			                    Background="#FFFFFFFF"
                                   BorderThickness="2"
                                  Foreground="Red"
                                     VerticalContentAlignment="Top"
                                  Cursor="Hand" 
                                  Padding="8"  SelectedItemChanged="ControlTree_SelectedItemChanged_1">
                            <TreeView.BitmapEffect>
                                <OuterGlowBitmapEffect></OuterGlowBitmapEffect>
                            </TreeView.BitmapEffect>
                            <TreeView.ItemTemplate>
                                <DataTemplate>
                                    <TextBlock Height="40" Foreground="Red" Text="{Binding Name}" />
                                </DataTemplate>
                            </TreeView.ItemTemplate>
                        </TreeView>
                        <GridSplitter Grid.Column="1" Width="15" HorizontalAlignment="Stretch" >
                            <GridSplitter.BitmapEffect>
                                <DropShadowBitmapEffect></DropShadowBitmapEffect>
                            </GridSplitter.BitmapEffect>
                        </GridSplitter>
                        <WebBrowser x:Name="ApplicationBrowser" Grid.Column="2" />
                    </Grid>
                    <Grid Grid.Row="3">
                    </Grid>
                </Grid>
            </Grid>
        </Grid>
    </Grid>
</RibbonWindow>
